package com._reflect;

import org.springframework.core.MethodParameter;

import java.lang.reflect.Method;

/**
 * Class<?> forName(String className)
 * Class<?> forName(String name, boolean initialize, ClassLoader loader)
 *
 * Class<?>[] getInterfaces()
 * Type[] getGenericInterfaces()
 * AnnotatedType[] getAnnotatedInterfaces()
 *
 * Class<? super T> getSuperclass()
 * Type getGenericSuperclass()
 * AnnotatedType getAnnotatedSuperclass()
 *
 * Class<?> getComponentType()
 *
 * <A extends Annotation> A getAnnotation(Class<A> annotationClass)
 * Annotation[] getAnnotations()
 * <A extends Annotation> A[] getAnnotationsByType(Class<A> annotationClass)
 * AnnotationType getAnnotationType()
 * <A extends Annotation> A getDeclaredAnnotation(Class<A> annotationClass)
 * Map<Class<? extends Annotation>, Annotation> getDeclaredAnnotationMap()
 * Annotation[] getDeclaredAnnotations()
 * <A extends Annotation> A[] getDeclaredAnnotationsByType(Class<A> annotationClass)
 * byte[] getExecutableTypeAnnotationBytes(Executable ex)
 *
 * byte[] getRawAnnotations()
 * byte[] getRawTypeAnnotations()
 */
public class _ClassDemo {

    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException {
        Class<?> aClass = Class.forName("com._reflect.AAA");
        Class<?> aClass1 = Class.forName("com._reflect.AAA", true, ClassLoader.getSystemClassLoader());

        AAA aaa = new AAA();
        Method[] methods = aaa.getClass().getMethods();
        System.out.println(methods);
        Method[] declaredMethods = aaa.getClass().getDeclaredMethods();
        System.out.println(declaredMethods);


        Method aaa1m = aaa.getClass().getDeclaredMethod("aaa1", Integer.class, String.class, Float.class, BBB.class, Class.class, int.class);
        MethodParameter aaas =  new MethodParameter(aaa1m, -1);
        Class<?> parameterType = aaas.getParameterType();
        System.out.println(parameterType.getName());
    }
}
